﻿@model SelfMadeMillionaire.Web.Infrastructure.ViewModels.Publications.PublicationEditViewModel
@using SelfMadeMillionaire.Web.Infrastructure



<div class="row">
	<div class="col-sm-4">
		<div class="form-group">
			@Html.LabelFor(model => model.Publication.ProductType, new { @class = "col-sm-6 control-label" })
			<div class="col-sm-6">
				@Html.DropDownListFor(m => m.Publication.ProductType, Model.ProductTypes, new { @class = "form-control" })
				@Html.ValidationMessageFor(model => model.Publication.ProductType)
			</div>
		</div>
	</div>

	<div class="col-sm-4">
		<div class="form-group">
			@Html.LabelFor(model => model.Publication.Title, new { @class = "col-sm-2 control-label" })
			<div class="col-sm-10">
				@Html.TextBoxFor(model => model.Publication.Title, new { @class = "form-control" })
				@Html.ValidationMessageFor(model => model.Publication.Title)
			</div>
		</div>
	</div>
	<div class="col-sm-4">
		<div class="form-group">
			@Html.LabelFor(model => model.MinAccessLevel, new { @class = "col-sm-6 control-label" })
			<div class="col-sm-6">
				@Html.DropDownListFor(m => m.Publication.MinAccessLevel, Model.AccessLevels, new { @class = "form-control" })
			</div>
		</div>
	</div>
</div>
<div class="row">
	<div class="col-sm-3">
		<div class="form-group">
			<label class="col-sm-6 control-label">Date</label>
			<div class="col-sm-5">
				@Html.TextBoxFor(model => model.Publication.Date, "{0:" + Constants.DATE_FORMAT + "}", new { @class = "form-control" })
				@Html.ValidationMessageFor(model => model.Publication.Date)
			</div>
		</div>
	</div>
	<div class="col-sm-2">
		<div class="form-group">
			<label class="col-sm-12 control-label">
				Show on product page
				@Html.EditorFor(model => model.Publication.IsShowOnHomePage, new { @class = "form-control" })
			</label>
		</div>
	</div>
    <div class="col-sm-2">
		<div class="form-group">
			<label class="col-sm-12 control-label">
				Show on Startpage
				@Html.EditorFor(model => model.Publication.IsShowOnStartPage, new { @class = "form-control" })
			</label>
		</div>
	</div>
	<div class="col-sm-2">
		<div class="form-group">
			<label class="col-sm-12 control-label">
				Education
				@Html.EditorFor(model => model.Publication.IsEducation, new { @class = "form-control" })
			</label>
		</div>
	</div>
	<div class="col-sm-3">
		<div class="form-group">
			@Html.LabelFor(model => model.PdfFile, new { @class = "col-sm-2 control-label" })
			<div class="col-sm-10">
				@Html.HiddenFor(m => m.Publication.PdfFileName)
				<input type="file" id="@Html.IdFor(m => m.PdfFile)" name="@Html.NameFor(m => m.PdfFile)" />
				@Html.ValidationMessageFor(model => model.PdfFile)
			</div>
		</div>
	</div>
</div>
<div class="row">
    <label class = "col-sm-2 control-label">Portfolios</label>
    @for (int i = 1; i < Model.ProductTypes.Count(); ++i )
    {
        var item = Model.ProductTypes.ElementAt(i);
        <div class="col-sm-2">
		<div class="form-group">
			<label class="col-sm-12 control-label">
				@item.Text
                <input type="checkbox" name="SelectedProducts" value="@item.Value" id="@item.Value" @{if (Model.SelectedProducts.Contains(Convert.ToInt32(item.Value)))
                                                                                                      { <text> checked='checked' </text>  } } />
			</label>
		</div>
	    </div>
        }
</div>
<div class="row">
	<div class="col-sm-12">
		<div class="form-group">
			@Html.LabelFor(model => model.ShortText, new { @class = "col-sm-2 control-label" })
			<div class="col-sm-10">
				@Html.TextAreaFor(model => model.ShortText, new { rows = 5, cols = 50, @class = "form-control" })
				@Html.ValidationMessageFor(model => model.ShortText)
			</div>
		</div>
	</div>
</div>
<div class="row">
	<div class="col-sm-12">
		<div class="form-group">
			@Html.LabelFor(model => model.Publication.ExternalUrl, new { @class = "col-sm-2 control-label" })
			<div class="col-sm-10">
				@Html.TextBoxFor(model => model.Publication.ExternalUrl, new { @class = "form-control" })
				@Html.ValidationMessageFor(model => model.Publication.ExternalUrl)
			</div>
		</div>
	</div>
</div>
<div class="row">
	<div class="col-sm-12">
		<div class="form-group">
			@Html.LabelFor(model => model.HtmlContent, new { @class = "col-sm-2 control-label" })
			<div class="col-sm-10">
				@Html.TextAreaFor(model => model.HtmlContent, new { rows = 20, cols = 50, @class = "form-control" })
				@Html.ValidationMessageFor(model => model.HtmlContent)
			</div>
		</div>
	</div>
</div>

<script type="text/javascript">
	tinymce.init({
		selector: "#@Html.IdFor(m => m.HtmlContent)",
	plugins: "image link code"
});

tinymce.init({
	selector: "#@Html.IdFor(m => m.ShortText)",
		plugins: "image link code"
	});

	$(function () {
		$("#@Html.IdFor(m => m.Publication.Date)").datepicker();
	});

</script>
